#ifndef OBJECT_H
#define OBJECT_H

#include "Game Engine/Header/BulletUtil.h"
#include "Game Engine/Header/d3dUtil.h"
#include "Game Engine/Header/Mesh.h"

struct ObjectVertex
{
	D3DXVECTOR3 pos;
	D3DXVECTOR3 tangent;
	D3DXVECTOR3 normal;
	D3DXVECTOR2 texC;
};

struct ObjectFaces
{
	UINT i0;
	UINT i1;
	UINT i2;
};

class Object
{
public:
	Object();
	~Object();

	////////////////// Create classes for each of these //////////////////////
	enum Type
	{
		Player,
		Enemy,
		NPC,
		Environment,
		Static
	};

	//////////////////// Move PhysicsEngine and OBB stuff into Object ////////////////////

	enum Shape
	{
		Capsule,
		Cube,
		Cyl,
		Plane,
		Sph
	};

	virtual void	Init( Mesh* mesh, Shape shape = Cube,
						bool dynamic = true );

	void			Strafe( float d );
	void			Walk( float d );
	void			Rotate( float d, bool clockwise = true );

	void			GetAABB(D3DXVECTOR3& vMin, D3DXVECTOR3& vMax);

	virtual void	FixedPosition( D3DXVECTOR3& pos );

	virtual void	FixedRotation( float angle );

	//virtual void	Draw( Mesh& mesh, D3DXMATRIX& lightViewProj ) = 0;

	D3DXVECTOR3&	GetPosition();
	D3DXVECTOR3&	GetVelocity();

	void			SetPosition( D3DXVECTOR3 pos );
	void			SetVelocity( D3DXVECTOR3 vel );

	D3DXMATRIX&		World();

public:
	ID3DX10Mesh*	mMeshData;

protected:
	btRigidBody*	LocalCreateRigidBody( btDynamicsWorld* world, float mass, const btTransform& startTransform, btCollisionShape* shape );

	btRigidBody*	GetBody();

protected:
	btScalar		mDefaultContactProcessingThreshold;

	Mesh*			mMesh;

private:
	btRigidBody*	mBody;

	D3DXVECTOR3		mPosition;
	D3DXVECTOR3		mVelocity;

	D3DXMATRIX		mWorld;
	D3DXMATRIX		mChange;

	float			mAngle;
};

#endif